package pl.th.permission.plugin;

import pl.th.permission.plugin.node.annotation.AnnType;

public class MultiPleAnnotationException extends RuntimeException{

    public static MultiPleAnnotationException obtain(AnnType type, int requestCode) {
        if (type == AnnType.ON_GRANTED_CALLBACK || type == AnnType.ON_DENIED_CALLBACK) {
            return new MultiPleAnnotationException("the " + type + " can be only used once in a class");
        } else {
            return new MultiPleAnnotationException("the " + type + " with the same requestCode " + requestCode
                    + " can be only used once in a class");
        }
    }

    private MultiPleAnnotationException(String message) {
        super(message);
    }
}
